Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: auto chart bumps for development branches #152

Merged
merged 26 commits into from
Nov 6, 2024

Conversation

nicholasSUSE
Copy link
Collaborator

@nicholasSUSE nicholasSUSE commented Nov 5, 2024

Issue: rancher/ecm-distro-tools#500

Summary

This PR will add the feature for automatic chart bumps on the development branch for any chart owner who wants the feature.

The first chart owner to implement it will be the rancher-cis-benchmark chart from the security/infracloud team.

This is the auto-generated bump commit: rancher/charts@06f4ea5#diff-e64e27a7f6d146814115856a7f4fd6126aa07cff77caffdd0772d4612dac0a4b

These are the necessary changes to the package.yaml of the respective chart:

Roadmap

This is the first part of a final solution:

  • 1st part: auto-chart-bumps as a feature on charts-build-scripts
  • 2nd part: GHAction automation for a new auto-chart-bump everytime the upstream repository makes a new merge to their active release branch configured in the package.yaml

Before proceeding with the 2nd part, the auto-chart-bump will be manually executed and inspected for bumps.

This automation is only for the development branches, the release branches already have some automation but it is a very risky automation and will always require human inspection.

Rules

The versioning rules are enforced in every auto-bump, it is defined here:
versioning charts

The wiki for this feature can be found here:

2 types accepted:
- <package>
- <chart>/<version>/<package>
- InitDependencies handle the version rules and the lifecycle rules that will be needed to calculate the next version
- GetPackages is used for "make prepare, patch and charts"
@nicholasSUSE nicholasSUSE changed the title small refactor at main.go Feature: auto chart bumps for development branches Nov 5, 2024
Adding new fields:
- Auto (bool type) will come from the new package.yaml
- AutoGeneratedBumpVersion that will be calculated at the end of the process

Also Fixed GetGithubRepository branch variable which was not being used
This method will enforce that the package.yaml for an auto-chart-bump is following the standards.
The standards will be defined at the rancher/charts/wiki.
They were already discussed with the chart owner (rancher-cis-operator).
They will serve as a standard for all other chart owners that desire to adopt the feature
Adding checks for the upstream chart options.
This means the variables that are used to check the upstream chart repository.
Where the update will come from.
Adding checks for the upstream additional charts that problably will be CRDs.
On this part of the code there will probably exist needed modifications for new chart owners.
That will need to be evaluated in the future.
Adding documentation
Adding re-use of the general methods that are already used in the release process.
This is the most important feature.

- The loading of versions must check/parse the latest version(from the index.yaml),
- The loading of versions must check/parse the upstream version to release,
- the rules for version bumps must be applied: (Only +1 minor/patch bump per PR).

Build the AutoGeneratedBumpVersion at the end of the process
The latest version comes from the actual index.yaml which was already sorted.
The assetsVersionsMap was loaded from lifecycle.InitDependencies
parse/separate the latest version that might come in one of the following formats:
- 10X.Y.Z+upa.b.c
- a.b.c
- get the version to release from the upstream repository
- check if it is coming with a repo prefix version (it should never come with it)
- check if the version to release is newer or the same as the latest version
  - if it is the same it is an rc bump and it is ok
small modification without breaking changes at generally used function for pulling upstream repository
rules:
- If chart version bump was patch -> repoPrefixVersion bumps patch
- If chart version bump was Minor Or Major -> repoPrefixVersion bumps minor

The only major bump on repoPrefixVersion is when we have minor version bump of Rancher:
- Rancher  v2.9 - 104
- Rancher v2.10 - 105
adding the update to the release.yaml file
- adding support for autoGenBumpVersion
- not breaking any previous behavior
separating the version parsing and adding override for autoGenBumpVersion
- no changes here, just refactor
These fields were already present but not being used.
@nicholasSUSE nicholasSUSE marked this pull request as ready for review November 5, 2024 16:20
@nicholasSUSE nicholasSUSE requested a review from a team as a code owner November 5, 2024 16:20
@nicholasSUSE nicholasSUSE merged commit 41d67c0 into rancher:master Nov 6, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants